#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int i = 1, j = 0;
        for (; i < nums.size(); ++i)
        {
            if (nums[j] != nums[i])
            {
                nums[++j] = nums[i];
            }
        }
        return j + 1;
    }
};

int main()
{
    Solution s;
    vector<int> vi;
    vi.push_back(1);
    vi.push_back(1);
    vi.push_back(2);
    vi.push_back(3);
    vi.push_back(3);
    vi.push_back(3);
    int i = s.removeDuplicates(vi);
    cout << i << endl;
    return 0;
}